package org.spring.springboot.dao;

import org.apache.ibatis.jdbc.AbstractSQL;

public class CustomSQL extends AbstractSQL<CustomSQL> {

	CustomSQL VALUES_IF(String columns, String values, boolean ifExists) {
	    if(ifExists){
	    	VALUES(columns,values);
	    }
		return getSelf();
	}

	CustomSQL VALUES_IF(String columns, String values, boolean ifExists, String otherwise) {
	    if(ifExists){
	    	VALUES(columns,values);
	    }else{
	    	VALUES(columns,otherwise);
	    }
		return getSelf();
	}

	CustomSQL WHERE_IF(String conditions, boolean ifExists) {
		if (ifExists){
			WHERE(conditions);
		}
		return getSelf();
	}
	CustomSQL SET_IF(String sets, boolean ifExists) {
		if (ifExists){
			SET(sets);
		}
		return getSelf();
	}
	CustomSQL SET_IF(String sets, boolean ifExists, String otherwise) {
		if (ifExists){
			SET(sets);
		}else{
			SET(otherwise);
		}
		return getSelf();
	}



	//
	CustomSQL log() { // 该方法用于调试
		return getSelf();
	}

	@Override
	public CustomSQL getSelf() {
		// TODO Auto-generated method stub
		return this;
	}

}